import request from '@/utils/request';
import { id } from 'element-plus/es/locale';

// 查询商机列表
export function listRole(query: any) {
    return request({
        url: '/tienchin/business/list',
        method: 'get',
        params: query,
    });
}

// 查询商机id详细信息
export function getRole(roleId: any) {
    return request({
        url: '/tienchin/business/summary/' + roleId,
        method: 'get',
    });
}

// 新增商机
export function addRole(data: any) {
    return request({
        url: '/tienchin/business',
        method: 'post',
        data: data,
    });
}

// 修改商机
export function updateRole(data: any) {
    return request({
        url: '/tienchin/business',
        method: 'put',
        data: data,
    });
}

// 删除商机
export function delRole(businessIds: any) {
    return request({
        url: '/tienchin/business/' + businessIds,
        method: 'delete',
    });
}

// 获取所有商机渠道
export function channels() {
    return request({
        url: '/tienchin/business/channels',
        method: 'GET',
    });
}
// 根据商机ID查询一个商机的摘要信息
export function summary(businessIds: any) {
    return request({
        url: '/tienchin/business/summary/' + businessIds,
        method: 'GET',
    });
}
// 根据渠道id获取对应促销活动列表
export function activity(channelId: any) {
    return request({
        url: '/tienchin/business/activity/' + channelId,
        method: 'GET',
    });
}

// 根据id查询商机详情
export function business(Id: any) {
    return request({
        url: '/tienchin/business/' + Id,
        method: 'GET',
    });
}
// 查询所有课程-不分页
export function courseList() {
    return request({
        url: '/tienchin/business/all_course',
        method: 'GET',
    });
}
// 根据类型查询课程
export function courseType(type: any) {
    return request({
        url: '/tienchin/business/course/' + type,
        method: 'GET',
    });
}

export function baocun(data:any) {
    return request({
        url: 'tienchin/business/follow',
        method: 'post',
        data: data,
    });
}

// 根据商机ID查询一个商机的摘要信息
export function type(id: any) {
    return request({
        url: 'tienchin/follow/record/business/'+ id,
        method: 'get',
    });
}